import React ,{useState,useEffect} from 'react'
import { Space, Typography } from 'antd'
import { FormOutlined } from '@ant-design/icons'
import styles from './Logo.module.scss'
import { Link } from 'react-router-dom'
import useGetUserInfo  from '../hooks/useGetUserInfo'
import { LOGIN_PATHNAME,MANAGE_INDEX_PATHNAME} from "../router/index";
const { Title } = Typography
export default function Logo() {
  const {nickname,username}=useGetUserInfo()
  const [pathname,setPathname]=useState(LOGIN_PATHNAME)
  useEffect(()=>{
    if(nickname){
      setPathname(MANAGE_INDEX_PATHNAME)
    }
  },[nickname])
  return (
    <div>
      <Link to={pathname}>
        <Space className={styles.container}>
          <Title>
            <FormOutlined />
          </Title>
          <Title>问卷</Title>
        </Space>
      </Link>
    </div>
  )
}
